// 邮箱
const validateEmail = (rule, value, callback) => {
    if (!icu.util.jude(value, 'email')) {
        callback();
        return
    }
    callback(new Error(icu.util.jude(value, 'email')));
};
// 手机号
const validateMobile = (rule, value, callback) => {
    if (!icu.util.jude(value, 'phone')) {
        callback();
        return
    }
    callback(new Error(icu.util.jude(value, 'phone')));
};

let addConfig = {
    isShow: true,
    name: 'userAddUpdata',
    labelWidth: 120,
    form: [
        { type: 'cascader', key: 'tenantCode', label: '所属行政区', disabled: false, placeholder: '请选择租户编码', clearable: true, filterable: true, changeOnSelect: true, option: [], default: [] },
        { type: 'input', dataType: 'text', key: 'tenantName', label: '租户名称', icon: '', disabled: false, placeholder: '请输入租户名称', default: '' },
        { type: 'input', dataType: 'text', key: 'username', label: '登录账号', icon: '', disabled: false, placeholder: '请输入登录账号', default: '' },
        { type: 'input', dataType: 'text', key: 'password', label: '登录密码', icon: '', disabled: false, placeholder: '请输入登录密码', showwordlimit: true, maxlength: 30, default: '' },
        { type: 'input', dataType: 'text', key: 'realName', label: '真实姓名', icon: '', disabled: false, placeholder: '请输入真实姓名', default: '' },
        { type: 'input', dataType: 'text', key: 'email', label: '邮箱', icon: '', disabled: false, placeholder: '请输入邮箱', default: '' },
        { type: 'input', dataType: 'text', key: 'mobile', label: '手机号', icon: '', disabled: false, placeholder: '请输入手机号', default: '' },
        { type: 'input', dataType: 'text', key: 'horizon', label: '工作流地址', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'input', dataType: 'text', key: 'remarks', label: '备注', icon: '', disabled: false, placeholder: '请输入备注', default: '' },
        { type: 'select', multiple: true, key: 'roleIds', label: '角色配置', option: [], disabled: false, placeholder: '请选择角色配置', default: [] },
        { type: 'radio', key: 'status', label: '状态', textAlign: 'left', default: 1, radioData: [{ lable: '停用', value: 0 }, { lable: '启用', value: 1 }] },
    ],
    rules: {
        tenantCode: [{ type: 'array', required: true, message: '请选择', trigger: 'change' }],
        tenantName: [{ required: true, message: '请输入', trigger: 'blur' }],
        username: [{ required: true, message: '请输入', trigger: 'blur' }],
        password: [{ required: true, message: '请输入', trigger: 'blur' }],
        realName: [{ required: true, message: '请输入', trigger: 'blur' }],
        horizon: [{ required: true, message: '请输入', trigger: 'blur' }],
        email: [{ required: true, message: '请输入', trigger: 'blur' }, { validator: validateEmail, trigger: 'blur' }],
        mobile: [{ required: true, message: '请输入', trigger: 'blur' }, { validator: validateMobile, trigger: 'blur' }]
    },
    grid: {
        xl: 24,
        lg: 24,
        md: 24,
        sm: 24,
        xs: 24
    },
    event: {
        iconInput: () => { }
    } // 动态绑定事件
}
let editConfig = {
    isShow: true,
    name: 'userAddUpdata',
    labelWidth: 120,
    form: [
        { type: 'cascader', key: 'tenantCode', label: '所属行政区', disabled: false, placeholder: '请选择租户编码', clearable: true, filterable: true, changeOnSelect: true, option: [], default: [] },
        { type: 'input', dataType: 'text', key: 'tenantName', label: '租户名称', icon: '', disabled: false, placeholder: '请输入租户名称', default: '' },
        { type: 'input', dataType: 'text', key: 'username', label: '登录账号', icon: '', disabled: false, placeholder: '请输入登录账号', default: '' },
        { type: 'input', dataType: 'text', key: 'realName', label: '真实姓名', icon: '', disabled: false, placeholder: '请输入真实姓名', default: '' },
        { type: 'input', dataType: 'text', key: 'email', label: '邮箱', icon: '', disabled: false, placeholder: '请输入邮箱', default: '' },
        { type: 'input', dataType: 'text', key: 'mobile', label: '手机号', icon: '', disabled: false, placeholder: '请输入手机号', default: '' },
        { type: 'input', dataType: 'text', key: 'horizon', label: '工作流地址', icon: '', disabled: false, placeholder: '请输入手机号', default: '' },
        { type: 'input', dataType: 'text', key: 'remarks', label: '备注', icon: '', disabled: false, placeholder: '请输入备注', default: '' },
        { type: 'select', multiple: true, key: 'roleIds', label: '角色配置', option: [], disabled: false, placeholder: '请选择角色配置', default: [] },
        { type: 'radio', key: 'status', label: '状态', textAlign: 'left', default: 1, radioData: [{ lable: '停用', value: 0 }, { lable: '启用', value: 1 }] },
    ],
    rules: {
        tenantCode: [{ type: 'array', required: true, message: '请选择', trigger: 'change' }],
        tenantName: [{ required: true, message: '请输入', trigger: 'blur' }],
        username: [{ required: true, message: '请输入', trigger: 'blur' }],
        realName: [{ required: true, message: '请输入', trigger: 'blur' }],
        horizon: [{ required: true, message: '请输入', trigger: 'blur' }],
        email: [{ required: true, message: '请输入', trigger: 'blur' }, { validator: validateEmail, trigger: 'blur' }],
        mobile: [{ required: true, message: '请输入', trigger: 'blur' }, { validator: validateMobile, trigger: 'blur' }]
    },
    grid: {
        xl: 24,
        lg: 24,
        md: 24,
        sm: 24,
        xs: 24
    },
    event: {
        iconInput: () => {
        }
    } // 动态绑定事件
}
export { addConfig, editConfig }